//TESH.scrollpos=19
//TESH.alwaysfold=0
function Trig_wave_monster_spown_1Actions takes nothing returns nothing
    local integer player_id = 0
    local integer monster_owner_id = player_id + 8
    local integer player_index = 4
    local real monster_speed = 270
    local real max_hp_rate = 1
    local real time_wait = 0.5
    local integer monster_count = udg_WAVE_ENEMY_COUNT_NORMAL
    local integer count_index = 0
    
    if ((ModuloInteger(udg_WAVE_NOW, 10) == 0)) then
        set monster_speed = 180
        set max_hp_rate = 10
        set monster_count = udg_WAVE_ENEMY_COUNT_BOSS
        set time_wait = 1.5
    endif
        
    loop
        exitwhen count_index >= monster_count
        set player_id = 0
        set monster_owner_id = player_id + 8
        loop
            exitwhen player_id >= player_index
            if(GetPlayerSlotState(Player(player_id)) == PLAYER_SLOT_STATE_PLAYING) then
                //call CreateNUnitsAtLocFacingLocBJ(1, udg_WAVE_ENEMY_GROUP[udg_WAVE_NOW - 1], Player(monster_owner_id), udg_START_POINT_ARRAY[player_id], LAYABLE_MAP_POINT)
                //call SetUnitState(bj_lastCreatedUnit, UNIT_STATE_MAX_LIFE, max_hp_rate * (udg_HP_BASE + udg_HP_NEXT_ADD))
                //call SetUnitState(bj_lastCreatedUnit, UNIT_STATE_LIFE, GetUnitState(bj_lastCreatedUnit, UNIT_STATE_MAX_LIFE))
                //call SetUnitMoveSpeed(bj_lastCreatedUnit, monster_speed)
                call ST_monster_spown(udg_WAVE_ENEMY_GROUP[udg_WAVE_NOW - 1],Player(monster_owner_id), udg_START_POINT_ARRAY[player_id], max_hp_rate * (udg_HP_BASE + udg_HP_NEXT_ADD), monster_speed)
                // show damage trigger
                call TriggerRegisterUnitEvent(gg_trg_________________________u, bj_lastCreatedUnit, EVENT_UNIT_DAMAGED)
            endif
            set player_id = player_id + 1
            set monster_owner_id = player_id + 8
        endloop
        
        call PolledWait(time_wait)
        set count_index = count_index + 1
    endloop
endfunction

//===========================================================================
function InitTrig_wave_monster_spown_1 takes nothing returns nothing
    set gg_trg_wave_monster_spown_1 = CreateTrigger()
#ifdef DEBUG
    call YDWESaveTriggerName(gg_trg_wave_monster_spown_1, "wave_monster_spown_1")
#endif
    call TriggerAddAction(gg_trg_wave_monster_spown_1, function Trig_wave_monster_spown_1Actions)
endfunction

